const initialState = 0;

/**
 * 处理action，返回变更后的state
 * @param {*} state 当前state
 * @param {object} action 描述当前如何变更
 * @returns state 变更后的state
 */
export default function reducer(state = initialState, action) {
  switch (action.type) {
    case "increment":
      return state + 1;
    case "decrement":
      return state - 1;;
    default:
      return state;
  }
};
